//
//  MZYnewTableViewCell.m
//  WristWatch
//
//  Created by dllo on 15/10/30.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "MZYnewTableViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation MZYnewTableViewCell

- (void)dealloc {
    [_titleLabel release];
    [_oneImageView release];
    [_twoImageView release];
    [_threeImageView release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.numberOfLines = 0;
    [_titleLabel release];
    
    self.oneImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.oneImageView];
    [_oneImageView release];
    
    self.twoImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.twoImageView];
    [_twoImageView release];
    
    self.threeImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.threeImageView];
    [_threeImageView release];
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:18], NSFontAttributeName, nil];
    CGRect rect = [self.titleLabel.text boundingRectWithSize:CGSizeMake(WIDTH, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.titleLabel.frame = CGRectMake(WIDTH / 25 - 5, HEIGHT / 12, WIDTH, rect.size.height);
    self.titleLabel.font = [UIFont systemFontOfSize:18];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
    self.oneImageView.frame = CGRectMake(WIDTH / 25, rect.size.height + 15, WIDTH / 3 - 20, HEIGHT / 2);
    self.twoImageView.frame = CGRectMake(WIDTH / 2.5 - 15, rect.size.height + 15, WIDTH / 3 - 20, HEIGHT / 2);
    self.threeImageView.frame = CGRectMake(WIDTH / 1.5 + 5, rect.size.height + 15, WIDTH / 3 - 20, HEIGHT / 2);
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
